
loop_time = 0.01
new_site_location = '/#'


function go_to_another_site(){
	window.location.href = new_site_location
}

function on_schedule(){
    setTimeout(loop, 1000 * loop_time);
	new_site_location = '/on_schedule' + document.location.search
    setTimeout(go_to_another_site, 800);
}

function on_operation_hour(){
    setTimeout(loop, 1000 * loop_time);
	new_site_location = '/on_operation_hour' + document.location.search
    setTimeout(go_to_another_site, 800);
}

function on_patient_history(){
    setTimeout(loop, 1000 * loop_time);
	new_site_location = '/on_patient_history' + document.location.search
    setTimeout(go_to_another_site, 800);
}


function loop(){

	image_div = document.getElementById('base_image_id')
	image_style = image_div.currentStyle || window.getComputedStyle(image_div)
	margin = parseFloat(image_style.marginTop.replace('px',''))
	image_div.style.marginTop = (margin - 2) + 'px'

	if((margin-1) < 0){
		image_div.style.marginTop = '0px'
		return
	}


	image_div = document.getElementById('base_link_id')
	image_style = image_div.currentStyle || window.getComputedStyle(image_div)
	margin = parseFloat(image_style.marginTop.replace('px',''))
	image_div.style.marginTop = (margin - 1) + 'px'

    setTimeout(loop, 1000 * loop_time);
}


